﻿namespace ScrumLite.Data.Tests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Transactions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using System.Collections.ObjectModel; 

    /// <summary>
    /// Summary description for ExcludedUserStoreFixture
    /// </summary>
    [TestClass]
    public class ExcludedUserStoreFixture
    {
        IExcludedUserStore store;

        [TestInitialize]
        public void Initialize()
        {
            store = new ExcludedUserStore();
        }

        [TestMethod()]
        public void ShouldGetExcludedUsers()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                using (ScrumLiteDataContext context = new ScrumLiteDataContext())
                {
                    ExcludedUser user = new ExcludedUser { samAccountName = "user" };

                    context.ExcludedUsers.InsertOnSubmit(user);
                    context.SubmitChanges();
                }

                string[] users = store.GetExcludedUsers();

                Assert.IsTrue(users.Count() > 0);
            }
        }
    }
}
